package com.leyou.auth.service;

import com.leyou.common.auth.entity.UserInfo;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Created by IntelliJ IDEA.
 *
 * @author: wangzibeng
 * Date: 2019/5/14 0014
 * Time: 22:47
 */

public interface AuthService {
    /**
     * 用户登录
     *
     * @param username 用户名
     * @param password 密码
     * @param response response
     */
    void login(String username, String password, HttpServletResponse response);

    /**
     * 验证用户信息 判断是否登录
     *
     * @param request  获取cookie
     * @param response 写
     * @return UserInfo
     */
    UserInfo verifyUser(HttpServletRequest request, HttpServletResponse response);

    /**
     * 用户退出注销  清除token及cookie
     *
     * @param request  获取cookie
     * @param response re
     */
    void logoutUser(HttpServletRequest request, HttpServletResponse response);

    /**
     * 微服务认证并申请令牌
     *
     * @param id     服务Id
     * @param secret 秘钥
     * @return token
     */
    String authenticate(Long id, String secret);

}
